package com.example.designpattern.singleton;

/**
 * 懒汉式
 * @author long
 * @date 2024/12/31 13:52
 */
public class LazyMode {

    // 私有化构造方法
    private LazyMode(){
    }

    private volatile static LazyMode instance;

    public static LazyMode getInstance(){
        if(instance == null){
            synchronized (LazyMode.class){
                if(instance == null){
                    instance = new LazyMode();
                }
            }
        }

        return instance;
    }
}
